package cn.itcast.demo.clients;

import cn.itcast.demo.fallback.UserClientFallbackFactory;
import cn.itcast.demo.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
/**
 * Feign封装了Ribbon和RestTemplate，实现负载均衡和发送请求
 *
 * @author wwk*/
@FeignClient(value = "user-service", fallbackFactory = UserClientFallbackFactory.class)
public interface UserClient {

    @GetMapping("/user/{id}")
    User findById(@PathVariable("id") Long id);
}
